<i><%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
	<!DOCTYPE html>
	<html>
<head>
<meta charset="UTF-8">
<title>服务-公用表(1:金融保险 2：智慧传承 3：生前契约) 编辑页面</title>
<meta
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
	name="viewport">
<jsp:include page="../com/header.jsp"></jsp:include>
<script type="text/javascript" src="../../js/comm/editcomm.js"></script>
<script type="text/javascript">
		$(function(){
			$("#saveOrupdate").click(function(){
				$("#img").val(imgUrl);
				if (!$('#serviceCommonContent').find('#myImageShow').attr('src')) {
					myAlert("请上传图片");
					return;
				}
				saveData(root + 'cms/serviceCommon/saveServiceCommon','serviceCommonList.jsp');
			});
			var tId = getUrlParam("id");
			if (!tId) {
				myAlert('id参数不能为空');
				return;
			}
			$.ajax({
				url : root + 'cms/serviceCommon/findServiceCommonById',
				type : 'post',
				dataType : 'json',
				data : {
					modelId : tId
				},
				success : function(data) {
					console.log(data);
					if (data.code == 1) {
						var contentHtml = $('#serviceCommonTmpl').render(
								data.object, {
									mydata : data
								});
						$('#serviceCommonContent').html(contentHtml);
						ue = UE.getEditor("content");
						ue.addListener("ready", function() {
							if (data.object.content)
								ue.setContent(data.object.content);
						});
					} else {
						var contentHtml = $('#serviceCommonTmpl').render("");
						$('#serviceCommonContent').html(contentHtml);
					}
				}
			});
			//上传图片
			$('#serviceCommonContent').on('click','#uploadPhotoFile', function () {
				upload("serviceCommon");
	        });
		});
</script>
</head>
<body>
	<section>
		<div>
			<div class="col-xs-12">
				<div class="box" style="height:900px;font-style: normal">
					<div class="box-header">
						<br> <input type="button" value="确定" id="saveOrupdate"
							class="btn btn-success">
						<input type="button" onclick="backAction('serviceCommonList.jsp');" class="btn btn-info" value="返回"/>
					</div>
					<form id="submit_form" class="form-horizontal">
						<div class="tab" id="serviceCommonContent"></div>
					</form>
				</div>
			</div>
		</div>
	</section>
	<script type="text/x-jsrender" id="serviceCommonTmpl">
			<fieldset>
				<input type="hidden" id="tId" name="id" value="{{:id}}" />
	        	{{!--<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">图片：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
                        	<img id="myImageShow" src="../../{{:imgUrl}}" width="100px" height="100px" />
                        	<input type="hidden" id="imgUrl" name="imgUrl" value="{{:imgUrl}}"/>
                        	<input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
                        </div>
					</div>
      			</div>--}}
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">标题：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写标题" class="form-control input-sm" data-rule="required;length[0~50]" id="title" name="title" value="{{:title}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">图片：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
                        	<img id="myImageShow" src="../../{{:img}}" width="100px" height="100px" />
                        	<input type="hidden" id="img" name="img" value="{{:img}}"/>
                        	<input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
                        </div>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">电话：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写服务电话" class="form-control input-sm" data-rule="required;length[0~50]" id="tel" name="tel" value="{{:tel}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">类型：</label>
       				 <div class="col-md-3">
						<select class="form-control input-sm" id="serviceType" name="serviceType" data-rule="required" >
                          <option  value="">请选择</option>
                          <option  value="4" {{if serviceType=="4"}}selected{{/if}}>医疗服务</option>
                          <option  value="1" {{if serviceType=="1"}}selected{{/if}}>金融保险</option>
                          <!--<option  value="2" {{if serviceType=="2"}}selected{{/if}}>智慧传承</option>-->
						  <option  value="3" {{if serviceType=="3"}}selected{{/if}}>生前契约</option>
                        </select>	
					</div>
      			</div>
      			<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">服务价格：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写服务价格" class="form-control input-sm" data-rule="required;length[0~50];money" id="price" name="price" value="{{:price}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">排序值：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写排序值" class="form-control input-sm" data-rule="length[1~10];plus" maxlength="10" id="sort" name="sort" value="{{:sort}}" />
					</div>
      			</div>
      			<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">注意事项：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写注意事项" class="form-control input-sm" data-rule="required;length[0~50];" id="attention" name="attention" value="{{:attention}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">简介：</label>
					<div class="col-md-5">
       				    <textarea class="form-control" id="briefInfo" name="briefInfo" rows="8"
       				    placeholder="请填写简介"
       				    data-rule="required;length[1~1000];" date-tip="请输入简介1-1000字符"
       				    value="{{:briefInfo}}" style="resize:none;">{{:briefInfo}}</textarea>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">详细介绍：</label>
					<div class="col-md-9" id="content" name="content" style="height:200px;"></div>	
      			</div>
			</fieldset>
	</script>
</body>
	</html></i>